<extend name="Base/common"/>
<block name="body" >
    <div class="sleft">
        <form method="post" action="{:U('collectionlist')}">
            <div class="search-form">
                <input type="text" name="title" class="am-form-field am-radius search-input" value="{:I('title')}" placeholder="请输入商品名称">
                <a class="am-btn am-btn-primary" href="javascript:;" id="search" url="{:U('collectionlist')}">搜索</a>
            </div>
            <!--<button type="submit">提交</button>-->
        </form>
    </div>
    <div class="data-table table-striped">
        <table class="am-table am-table-bordered">
            <thead>
            <tr>
                <!--<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>-->
                <!--<th>ID</th>-->
                <th>ID</th>
                <th>商品名称</th>
                <th>价格</th>
                <th>创建时间</th>
                <th>来源</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <!--<td><input class="ids" type="checkbox" name="id[]" value="{$vo.material}" /></td>-->
                        <!--<td>{$vo.id}</td>-->
                        <td>{$vo.id}</td>
                        <td>{$vo.title}</td>
                        <td>{$vo.unit}</td>
                        <td>{$vo.createAt|time_format}</td>
                        <td>{$vo.src}</td>
                    </tr>
                </volist>
                <else/>
                <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>

</block>
<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            var queryselect = $('.search-form').find('select').serialize();

            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            queryselect = queryselect.replace(/^&/g, '');

            if (url.indexOf('?') > 0) {
                url += '&' + query;
                url += '&' + queryselect;
            } else {
                url += '?' + query;
                url += '?' + queryselect;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });

    </script>
</block>